DISCUSSION
MPNotifyQueue
allocates spaces for messages dynamically; that is, memory to hold the message is allocated for the queue at the time of the call. In most cases this method is both speed and storage efficient. However, it is possible that, due to lack of memory resources, space for the message may not be available at the time of the call; in such cases,
MPNotifyQueue
will return
kInsufficientResourcesErr
.
If you must have guaranteed message delivery, or if you need to call
MPNotifyQueue
from an interrupt handler, you should reserve space on the specified queue by calling
MPSetQueueReserve
. Because such allocated space is reserved for duration of the queue's existence, you should avoid straining internal system resources by reserving messages only when absolutely necessary. Note that if you have reserved messages on a queue, additional space
cannot
be added dynamically if the number of messages exceeds the number reserved for that queue.
The number of reserved messages is set to
count
, lowering or increasing the current number of reserved messages as required. If
count
is set to zero, no messages are reserved for the queue, and space for messages is allocated dynamically.